﻿#define public Dependency_NoExampleSetup
#include "CodeDependencies.iss"

[Setup]

#define UseDotNet60Desktop
#define UseNetCoreCheck

#define MyAppSetupName 'RapidCAX'
#define MyAppExe 'Rapid.CAX.exe'
#define MyAppVersion '1.0'
#define MyAppPublisher 'AnyCAD Ltd.'
#define MyAppCopyright 'Copyright © AnyCAD Ltd.'
#define MyAppURL 'http://www.anycad.cn'
#define MySubDir '.\bin\Release\net6.0-windows'

SourceDir=.
OutputDir=.\bin

AppName={#MyAppSetupName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppSetupName} {#MyAppVersion}
AppCopyright={#MyAppCopyright}
VersionInfoVersion={#MyAppVersion}
VersionInfoCompany={#MyAppPublisher}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
OutputBaseFilename={#MyAppSetupName}-{#MyAppVersion}
DefaultGroupName={#MyAppSetupName}
DefaultDirName={autopf}\{#MyAppSetupName}
UninstallDisplayIcon={app}\MyProgram.exe
AllowNoIcons=yes
PrivilegesRequired=admin

; remove next line if you only deploy 32-bit binaries and dependencies
ArchitecturesInstallIn64BitMode=x64

[Languages]
Name: en; MessagesFile: "compiler:Default.isl"

[Files]
#ifdef UseNetCoreCheck
; download netcorecheck.exe: https://go.microsoft.com/fwlink/?linkid=2135256
; download netcorecheck_x64.exe: https://go.microsoft.com/fwlink/?linkid=2135504
Source: ".\Tool\netcorecheck.exe"; Flags: dontcopy noencryption
Source: ".\Tool\netcorecheck_x64.exe"; Flags: dontcopy noencryption
#endif

Source: "{#MySubDir}\{#MyAppExe}"; DestDir: "{app}"; DestName: "{#MyAppExe}"; Flags: ignoreversion
Source: "{#MySubDir}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs

[Icons]
Name: "{group}\{#MyAppSetupName}"; Filename: "{app}\{#MyAppExe}"
Name: "{group}\{cm:UninstallProgram,{#MyAppSetupName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppSetupName}"; Filename: "{app}\{#MyAppExe}"; Tasks: desktopicon

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"

[Run]
Filename: "{app}\{#MyAppExe}"; Description: "{cm:LaunchProgram,{#MyAppSetupName}}"; Flags: nowait postinstall skipifsilent

[Code]
function InitializeSetup: Boolean;
begin
  Dependency_AddVC2015To2022;
#ifdef UseDotNet60Desktop
  Dependency_AddDotNet60Desktop;
#endif
#ifdef UseDotNet48
  Dependency_AddDotNet48;
#endif

  Result := True;
end;